{% extends 'home.html' %}
{% block content %}

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>卡尔费休库仑法水分仪校准</title>
    <link href="/static/css/kfc_yb.css" rel="stylesheet">
    </link>
    <script src="/static/bootstrap/js/jquery.min.js" type="text/javascript"></script>
    <script src="/static/js/kfc_yb.js" type="text/javascript"></script>
</head>

<body onload="disableBackButton();" onpageshow="if (event.persisted) disableBackButton();" class="">
    <script>
        function disableBackButton() {
            window.history.forward();
        }
    </script>
    <form name="form1" method="post" id="form1">

        <div class="c-layout-page">
            <div class="c-content-box c-size-md c-bg-white">
                <div class="container">
                    <div class="c-content-title-1">
                        <h3 class="c-center c-font-dark c-font-uppercase">卡尔费休库仑法水分仪校准</h3>
                        <div class="c-line-center c-theme-bg"></div>
                        <p class="c-center"></p>
                    </div>
                    <div class="c-content-panel">
                        <div class="c-label">仪器基础信息输入</div>
                        <div class="c-body">
                            <div class="row">
                                <div class="col-md-12">
                                    <table class="table">
                                        <tbody>
                                            <tr>
                                                <th scope="row" style="text-align:center">仪器名称</th>
                                                <td colspan="2"><input name="A1PH_Name01" type="text" value="卡尔费休库仑法水分仪"
                                                        id="A1PH_Name01" style="height:25px;width:350px"></td>
                                                <th style="text-align:center">仪器接收编号</th>
                                                <td colspan="2"><input name="A1PH_Received02" type="text"
                                                        value="{{ A1PH_Received02 }}" readonly="readonly"
                                                        id="A1PH_Received02"
                                                        style="background-color:#F3F3F3;height:25px; width:300px">
                                                </td>
                                            </tr>

                                            <tr>
                                                <th scope="row" style="text-align:center">型号/规格</th>
                                                <td><input name="A1PH_ProdModel03" type="text" id="A1PH_ProdModel03"
                                                        style="height:25px;width:240px"></td>
                                                <th style="text-align:center">仪器序列号</th>
                                                <td><input name="A1PH_SN04" type="text" id="A1PH_SN04"
                                                        style="height:25px">
                                                </td>
                                                <!-- ... existing code ... -->
                                                <th style="text-align:center">环境条件</th>
                                                <td>
                                                    <input name="A1PH_Wd11" type="text" id="A1PH_Wd11"
                                                        style="height:25px; width:50px"
                                                        onblur="formatToOneDecimal(this)">&nbsp;°C &nbsp;&nbsp;
                                                    <input name="A1PH_Sd12" type="text" id="A1PH_Sd12"
                                                        style="height:25px; width:50px"
                                                        onblur="formatToOneDecimal(this)">&nbsp;%RH
                                                    <script>
                                                        function formatToOneDecimal(inputElement) {
                                                            if (inputElement.value !== '') {
                                                                const value = parseFloat(inputElement.value);
                                                                if (!isNaN(value)) {
                                                                    inputElement.value = value.toFixed(1);
                                                                }
                                                            }
                                                        }

                                                        // 页面加载时也格式化已有的值
                                                        document.addEventListener('DOMContentLoaded', function () {
                                                            formatToOneDecimal(document.getElementById('A1PH_Wd11'));
                                                            formatToOneDecimal(document.getElementById('A1PH_Sd12'));
                                                        });
                                                    </script>
                                                </td>
                                                <!-- ... existing code ... -->
                                            </tr>
                                            <tr>
                                                <th style="text-align:center" scope="row">校准依据</th>
                                                <td colspan="3"><input name="A1PH_Xz06" type="text"
                                                        value="JJG1044-2008卡尔·费休库伦法微量水分测定仪检定规程" id="A1PH_Xz06"
                                                        style="height:25px;width:610px"></td>
                                                <th style="text-align:center">校准日期</th>
                                                <td><input name="A1PH_Rq07" type="text" value="{{ date }}"
                                                        id="A1PH_Rq07" style="height:25px"></td>
                                            </tr>

                                            <tr>
                                                <td colspan="6"
                                                    style="height:20px;text-align:center;background-color:aliceblue">
                                                    标准器及配套设备
                                                </td>
                                            </tr>

                                            <tr>
                                                <td colspan="6">
                                                    <table class="table" id="tools">
                                                        <tbody>
                                                            <tr>

                                                                <th style="text-align:center">名称/型号</th>
                                                                <th style="text-align:center">编号</th>
                                                                <th style="text-align:center">测量范围</th>
                                                                <th style="text-align:center">批号/证书编号</th>
                                                                <th style="text-align:center">有效期</th>
                                                                <th style="text-align:center">校准机构</th>
                                                                <th style="text-align:center">计量特性</th>
                                                            </tr>
                                                            <tr>
                                                                <td><input name="BLPH_Xmxh16" type="text" value="/"
                                                                        id="BLPH_Xmxh16" style="height:25px"></td>
                                                                <td><select name="BLPH_Bh17" id="BLPH_Bh17"
                                                                        style="height:30px;width:107px;">
                                                                        <option selected="selected" value="0">==请选择==
                                                                        </option>
                                                                        {% for tool in tools %}
                                                                        <option value="{{ tool.tool_number }}">{{ tool.tool_number }}</option>
                                                                        {% endfor %}

                                                                    </select></td>
                                                                <td><input name="BLPH_FW_01" type="text" value="/" id="BLPH_FW_01"
                                                                        style="height:25px;width:60px"></td>
                                                                <td><input name="BLPH_Jlzsbh18" type="text" value="/"
                                                                        id="BLPH_Jlzsbh18" style="height:25px"></td>
                                                                <td><input name="BLPH_Yxrq19" type="text" value="/"
                                                                        id="BLPH_Yxrq19" style="height:25px"></td>
                                                                <td><input name="BLPH_Yzjg20" type="text" value="/"
                                                                        id="BLPH_Yzjg20"
                                                                        style="height:25px;width:100px"></td>
                                                                <td><input name="BLPH_Zqddj21" type="text" value="/"
                                                                        id="BLPH_Zqddj21"
                                                                        style="height:25px; width:140px"></td>

                                                            </tr>
                                                            <tr>
                                                                <td><input name="BLPH_Xmxh22" type="text" value="/"
                                                                        id="BLPH_Xmxh22" style="height:25px"></td>
                                                                <td><input name="BLPH_Bh23" type="text" value="/"
                                                                        id="BLPH_Bh23" style="height:25px;width:100px">
                                                                </td>
                                                                <td><input name="BLPH_FW_02" type="text" value="/"
                                                                        id="BLPH_FW_02" style="height:25px;width:60px">
                                                                </td>
                                                                <td><input name="BLPH_Jlzsbh24" type="text" value="/"
                                                                        id="BLPH_Jlzsbh24" style="height:25px"></td>
                                                                <td><input name="BLPH_Yxrq25" type="text" value="/"
                                                                        id="BLPH_Yxrq25" style="height:25px"></td>
                                                                <td><input name="BLPH_Yzjg26" type="text" value="/"
                                                                        id="BLPH_Yzjg26"
                                                                        style="height:25px;width:100px"></td>
                                                                <td><input name="BLPH_Zqddj27" type="text" value="/"
                                                                        id="BLPH_Zqddj27"
                                                                        style="width:140px;height:25px">
                                                                </td>

                                                            </tr>
                                                            <tr>
                                                                <td><input name="BLPH_Xmxh28" type="text" value="/"
                                                                        id="BLPH_Xmxh28" style="height:25px"></td>
                                                                <td><input name="BLPH_Bh29" type="text" value="/"
                                                                        id="BLPH_Bh29" style="height:25px;width:100px">
                                                                </td>
                                                                <td><input name="BLPH_FW_03" type="text" value="/"
                                                                        id="BLPH_FW_03" style="height:25px;width:60px">
                                                                </td>
                                                                <td><input name="BLPH_Jlzsbh30" type="text" value="/"
                                                                        id="BLPH_Jlzsbh30" style="height:25px"></td>
                                                                <td><input name="BLPH_Yxrq31" type="text" value="/"
                                                                        id="BLPH_Yxrq31" style="height:25px"></td>
                                                                <td><input name="BLPH_Yzjg32" type="text" value="/"
                                                                        id="BLPH_Yzjg32"
                                                                        style="height:25px;width:100px"></td>
                                                                <td><input name="BLPH_Zqddj33" type="text" value="/"
                                                                        id="BLPH_Zqddj33"
                                                                        style="width:140px;height:25px">
                                                                </td>

                                                            </tr>
                                                            <tr>
                                                                <td><input name="BLPH_Xmxh34" type="text" value="/"
                                                                        id="BLPH_Xmxh34" style="height:25px"></td>
                                                                <td><input name="BLPH_Bh35" type="text" value="/"
                                                                        id="BLPH_Bh35" style="height:25px;width:100px">
                                                                </td>
                                                                <td><input name="BLPH_FW_04" type="text" value="/"
                                                                        id="BLPH_FW_04" style="height:25px;width:60px">
                                                                </td>
                                                                <td><input name="BLPH_Jlzsbh36" type="text" value="/"
                                                                        id="BLPH_Jlzsbh36" style="height:25px"></td>
                                                                <td><input name="BLPH_Yxrq37" type="text" value="/"
                                                                        id="BLPH_Yxrq37" style="height:25px"></td>
                                                                <td><input name="BLPH_Yzjg38" type="text" value="/"
                                                                        id="BLPH_Yzjg38"
                                                                        style="height:25px;width:100px"></td>
                                                                <td><input name="BLPH_Zqddj39" type="text" value="/"
                                                                        id="BLPH_Zqddj39"
                                                                        style="width:140px;height:25px">
                                                                </td>

                                                            </tr>
                                                            <tr>
                                                                <td><input name="BLPH_Xmxh40" type="text" value="/"
                                                                        id="BLPH_Xmxh40" style="height:25px"></td>
                                                                <td><input name="BLPH_Bh41" type="text" value="/"
                                                                        id="BLPH_Bh41" style="height:25px;width:100px">
                                                                </td>
                                                                <td><input name="BLPH_FW_05" type="text" value="/"
                                                                        id="BLPH_FW_05" style="height:25px;width:60px">
                                                                </td>
                                                                <td><input name="BLPH_Jlzsbh42" type="text" value="/"
                                                                        id="BLPH_Jlzsbh42" style="height:25px"></td>
                                                                <td><input name="BLPH_Yxrq43" type="text" value="/"
                                                                        id="BLPH_Yxrq43" style="height:25px"></td>
                                                                <td><input name="BLPH_Yzjg44" type="text" value="/"
                                                                        id="BLPH_Yzjg44"
                                                                        style="height:25px;width:100px"></td>
                                                                <td><input name="BLPH_Zqddj45" type="text" value="/"
                                                                        id="BLPH_Zqddj45"
                                                                        style="width:140px;height:25px">
                                                                </td>

                                                            </tr>
                                                            <tr>
                                                                <td><input name="BLPH_Xmxh46" type="text" value="/"
                                                                        id="BLPH_Xmxh46" style="height:25px"></td>
                                                                <td><input name="BLPH_Bh47" type="text" value="/"
                                                                        id="BLPH_Bh47" style="height:25px;width:100px">
                                                                </td>
                                                                <td><input name="BLPH_FW_06" type="text" value="/"
                                                                        id="BLPH_FW_06" style="height:25px;width:60px">
                                                                </td>
                                                                <td><input name="BLPH_Jlzsbh48" type="text" value="/"
                                                                        id="BLPH_Jlzsbh48" style="height:25px"></td>
                                                                <td><input name="BLPH_Yxrq49" type="text" value="/"
                                                                        id="BLPH_Yxrq49" style="height:25px"></td>
                                                                <td><input name="BLPH_Yzjg50" type="text" value="/"
                                                                        id="BLPH_Yzjg50"
                                                                        style="height:25px;width:100px"></td>
                                                                <td><input name="BLPH_Zqddj51" type="text" value="/"
                                                                        id="BLPH_Zqddj51"
                                                                        style="width:140px;height:25px">
                                                                </td>

                                                            </tr>
                                                            <tr>
                                                                <td>生产厂商</td>
                                                                <td colspan="6"><input name="A1PH_Sccs52" type="text"
                                                                        value="梅特勒托利多" id="A1PH_Sccs52"
                                                                        style="width:900px;height:25px"></td>


                                                            </tr>
                                                            <tr>
                                                                <td>证书单位</td>
                                                                <td colspan="6"><input name="A1PH_Zsdw53" type="text"
                                                                        id="A1PH_Zsdw53"
                                                                        style="width:900px;height:25px"></td>


                                                            </tr>
                                                            <tr>
                                                                <td>证书地址</td>
                                                                <td colspan="6"><input name="A1PH_Zsdz54" type="text"
                                                                        id="A1PH_Zsdz54"
                                                                        style="width:900px;height:25px"></td>


                                                            </tr>
                                                            <tr>
                                                                <td>校准地点</td>
                                                                <td colspan="6"><input name="A1PH_Xzdd55" type="text"
                                                                        id="A1PH_Xzdd55"
                                                                        style="width:900px;height:25px"></td>

                                                            </tr>

                                                        </tbody>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th colspan="6"
                                                    style="height:15px; text-align:left;background-color:aliceblue">
                                                    1. 通用技术要求
                                                </th>
                                            </tr>
                                            <tr>
                                                <th>外观及通电检查：</th>
                                                <td colspan="2">符合 <input id="A1PH_Wgjcfh56" type="checkbox"
                                                        name="A1PH_Wgjcfh56"></td>
                                                <td colspan="3">不符合 <input id="A1PH_Wgjcbfh57" type="checkbox"
                                                        name="A1PH_Wgjcbfh57"></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="c-content-panel">
                        <div class="c-label">2.示值误差（ug）</div>
                        <div class="c-body">
                            <div class="row">
                                <div class="col-md-12">
                                    <table class="table">
                                        <tbody>
                                            <tr>
                                                <th style="vertical-align:middle;width:50px;text-align:center">元素</th>
                                                <th style="vertical-align: middle;width:50px;text-align:center">检定点</th>
                                                <th style="vertical-align: middle;width:50px;text-align:center">W1</th>
                                                <th style="vertical-align: middle;width:50px;text-align:center">W2</th>
                                                <th style="vertical-align: middle;width:50px;text-align:center">
                                                    标准值<br>(W1-W2)
                                                    g
                                                </th>
                                                <th style="vertical-align: middle;width:50px;text-align:center">测量值<br>
                                                    ug
                                                </th>
                                                <th style="vertical-align: middle;width:50px;text-align:center">差值 ug
                                                </th>
                                                <th style="vertical-align: middle;width:50px;text-align:center">
                                                    示值误差<br>(平均值)
                                                </th>
                                                <th style="vertical-align: middle;width:50px;text-align:center">技术要求
                                                </th>
                                            </tr>
                                            <tr>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">标准水</td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">10</td>
                                                <td><input name="C1" type="text" id="C1" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C2" type="text" id="C2" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; "
                                                        onchange="_SetDigitalInput(2);"></td>
                                                <td><input name="C3" type="text" id="C3" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C4" type="text" id="C4" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(4);"></td>
                                                <td><input name="C5" type="text" id="C5" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">
                                                    <input name="C6" type="hidden" id="C6" readonly="readonly"
                                                        style="width:100px;  height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                    <input name="C14" type="text" id="C14" readonly="readonly"
                                                        style="width:100px; height:55px;border-width: 0px; border-style: inset; background-color:#FFFFFF">
                                                    <input name="C22" type="hidden" id="C22" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">
                                                    <input name="C7" type="hidden" id="C7" value="≤ ± 3.5 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                    <input name="C15" type="text" id="C15" value="≤ ± 3.5 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:55px;border-width: 0px; border-style: inset; background-color: #FFFFFF">
                                                    <input name="C23" type="hidden" id="C23" value="≤ ± 3.5 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">

                                                </td>
                                            </tr>

                                            <tr>


                                                <td><input name="C9" type="text" id="C9" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C10" type="text" id="C10" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(10);"></td>
                                                <td><input name="C11" type="text" id="C11" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C12" type="text" id="C12" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(12);"></td>
                                                <td><input name="C13" type="text" id="C13" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>

                                            </tr>

                                            <tr>
                                                <td><input name="C17" type="text" id="C17" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C18" type="text" id="C18" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(18);"></td>
                                                <td><input name="C19" type="text" id="C19" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C20" type="text" id="C20" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(20);"></td>
                                                <td><input name="C21" type="text" id="C21" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                            </tr>

                                            <tr>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">标准水</td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">100</td>
                                                <td><input name="C25" type="text" id="C25" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C26" type="text" id="C26" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(26);"></td>
                                                <td><input name="C27" type="text" id="C27" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C28" type="text" id="C28" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(28);"></td>
                                                <td><input name="C29" type="text" id="C29" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">
                                                    <input name="C30" type="hidden" id="C30" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                    <input name="C38" type="text" id="C38" readonly="readonly"
                                                        style="width:100px; height:55px;border-width:0px; border-style: inset; background-color: #FFFFFF">
                                                    <input name="C46" type="hidden" id="C46" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">
                                                    <input name="C31" type="hidden" id="C31" value="≤ ± 8 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                    <input name="C39" type="text" id="C39" value="≤ ± 8 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:55px;border-width: 0px; border-style: inset; background-color: #FFFFFF">
                                                    <input name="C47" type="hidden" id="C47" value="≤ ± 8 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                            </tr>

                                            <tr>
                                                <td><input name="C33" type="text" id="C33" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C34" type="text" id="C34" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(34);"></td>
                                                <td><input name="C35" type="text" id="C35" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C36" type="text" id="C36" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(36);"></td>
                                                <td><input name="C37" type="text" id="C37" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                            </tr>

                                            <tr>
                                                <td><input name="C41" type="text" id="C41" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C42" type="text" id="C42" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(42);"></td>
                                                <td><input name="C43" type="text" id="C43" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C44" type="text" id="C44" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(44);"></td>
                                                <td><input name="C45" type="text" id="C45" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                            </tr>

                                            <tr>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">标准水</td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">1000
                                                </td>
                                                <td><input name="C49" type="text" id="C49" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C50" type="text" id="C50" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(50);"></td>
                                                <td><input name="C51" type="text" id="C51" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C52" type="text" id="C52" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(52);"></td>
                                                <td><input name="C53" type="text" id="C53" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">
                                                    <input name="C54" type="hidden" id="C54" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                    <input name="C62" type="text" id="C62" readonly="readonly"
                                                        style="width:100px; height:55px;border-width: 0px; border-style: inset; background-color: #FFFFFF">
                                                    <input name="C70" type="hidden" id="C70" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">
                                                    <input name="C55" type="hidden" id="C55" value="≤ ± 53 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                    <input name="C63" type="text" id="C63" value="≤ ± 53 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:55px;border-width: 0px; border-style: inset; background-color: #FFFFFF">
                                                    <input name="C71" type="hidden" id="C71" value="≤ ± 53 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                            </tr>

                                            <tr>


                                                <td><input name="C57" type="text" id="C57" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C58" type="text" id="C58" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(58);"></td>
                                                <td><input name="C59" type="text" id="C59" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C60" type="text" id="C60" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(60);"></td>
                                                <td><input name="C61" type="text" id="C61" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>

                                            </tr>

                                            <tr>


                                                <td><input name="C65" type="text" id="C65" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C66" type="text" id="C66" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(66);"></td>
                                                <td><input name="C67" type="text" id="C67" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C68" type="text" id="C68" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(68);"></td>
                                                <td><input name="C69" type="text" id="C69" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>

                                            </tr>

                                            <tr>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">纯水</td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">5000
                                                </td>
                                                <td><input name="C73" type="text" id="C73" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C74" type="text" id="C74" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(74);"></td>
                                                <td><input name="C75" type="text" id="C75" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C76" type="text" id="C76" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(76);"></td>
                                                <td><input name="C77" type="text" id="C77" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">
                                                    <input name="C78" type="hidden" id="C78" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                    <input name="C86" type="text" id="C86" readonly="readonly"
                                                        style="width:100px; height:55px;border-width: 0px; border-style: inset; background-color: #FFFFFF">
                                                    <input name="C94" type="hidden" id="C94" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td rowspan="3" style="vertical-align:middle;text-align:center">
                                                    <input name="C79" type="hidden" id="C79" value="≤± 253 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                    <input name="C87" type="text" id="C87" value="≤± 253 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:55px;border-width: 0px; border-style: inset; background-color: #FFFFFF">
                                                    <input name="C95" type="hidden" id="C95" value="≤± 253 μg"
                                                        readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                            </tr>

                                            <tr>


                                                <td><input name="C81" type="text" id="C81" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C82" type="text" id="C82" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(82);"></td>
                                                <td><input name="C83" type="text" id="C83" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C84" type="text" id="C84" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(84);"></td>
                                                <td><input name="C85" type="text" id="C85" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                            </tr>

                                            <tr>


                                                <td><input name="C89" type="text" id="C89" value="0.00000"
                                                        onkeyup="CupperCase6(this)" style="width:100px; height:25px">
                                                </td>
                                                <td><input name="C90" type="text" id="C90" onkeyup="CupperCase6(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(90);"></td>
                                                <td><input name="C91" type="text" id="C91" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                                <td><input name="C92" type="text" id="C92" onkeyup="Wonkeyup(this)"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset;"
                                                        onchange="_SetDigitalInput(92);"></td>
                                                <td><input name="C93" type="text" id="C93" readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                            </tr>

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="c-content-panel">
                        <div class="c-label">3.示值重复性</div>
                        <div class="c-body">
                            <div class="row">
                                <div class="col-md-12">
                                    <table class="table table-bordered">

                                        <tbody>

                                            <tr>
                                                <th style="vertical-align:middle;text-align:center">次数</th>
                                                <th style="vertical-align:middle;text-align:center">实测值/ug</th>
                                                <th style="vertical-align:middle;text-align:center">平均值/ug</th>
                                                <th style="vertical-align:middle;text-align:center">相对标准偏差 %</th>
                                                <th style="vertical-align:middle;text-align:center">技术要求</th>

                                            </tr>
                                            <tr>
                                                <td style="vertical-align:middle;text-align:center">1</td>
                                                <td><input name="B0" type="text" id="B0" onkeyup="CupperCase(this)"
                                                        onchange="SetDigitalInputB(0);"
                                                        style="width:140px; height:25px">
                                                </td>
                                                <td rowspan="6" style="vertical-align:middle;text-align:center">
                                                    <div id="B1">
                                                    </div>
                                                    <input name="B5"  readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3" id="B5">
                                                </td>
                                                <td rowspan="6" style="vertical-align:middle;text-align:center">
                                                    <div id="B2"></div>
                                                    <input name="B6"  readonly="readonly"
                                                        style="width:100px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3" id="B6">
                                                </td>
                                                <td rowspan="6" style="vertical-align:middle;text-align:center">
                                                    <div id="B3">≤3 %</div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="vertical-align:middle;text-align:center">2</td>
                                                <td><input name="B4" type="text" id="B4" onkeyup="CupperCase(this)"
                                                        onchange="SetDigitalInputB(4);"
                                                        style="width:140px; height:25px">
                                                </td>

                                            </tr>

                                            <tr>
                                                <td style="vertical-align:middle;text-align:center">3</td>
                                                <td><input name="B8" type="text" id="B8" onkeyup="CupperCase(this)"
                                                        onchange="SetDigitalInputB(8);"
                                                        style="width:140px; height:25px">
                                                </td>

                                            </tr>

                                            <tr>
                                                <td style="vertical-align:middle;text-align:center">4</td>
                                                <td><input name="B12" type="text" id="B12" onkeyup="CupperCase(this)"
                                                        onchange="SetDigitalInputB(12);"
                                                        style="width:140px; height:25px">
                                                </td>

                                            </tr>
                                            <tr>
                                                <td style="vertical-align:middle;text-align:center">5</td>
                                                <td><input name="B16" type="text" id="B16" onkeyup="CupperCase(this)"
                                                        onchange="SetDigitalInputB(16);"
                                                        style="width:140px; height:25px">
                                                </td>

                                            </tr>
                                            <tr>
                                                <td style="vertical-align:middle;text-align:center">6</td>
                                                <td><input name="B20" type="text" id="B20"
                                                        onchange="SetDigitalInputB(20);" onkeyup="CupperCase(this)"
                                                        style="width:140px; height:25px"></td>
                                            </tr>

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="c-content-panel">
                        <div class="c-label">4.检查结果</div>
                        <div class="c-body">
                            <div class="row">
                                <div class="col-md-12">
                                    <table class="table table-hover">
                                        <tbody>
                                            <tr>
                                                <th style="vertical-align:middle;text-align:center">校准项目</th>
                                                <th style="vertical-align:middle;text-align:center">校准结果s</th>
                                                <th style="vertical-align:middle;text-align:center">技术要求</th>

                                            </tr>

                                            <tr>

                                                <td style="vertical-align:middle;text-align:center">电解速度</td>
                                                <td><input name="D0" type="text" id="D0" 
                                                        style="width:300px; height:25px">  s</td>
                                                <td><input name="D1" type="text" id="D1" value="≤ 180 s"
                                                        readonly="readonly"
                                                        style="width:110px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>


                                            </tr>
                                            <tr>
                                                <td style="vertical-align:middle;text-align:center">零点平衡时间</td>
                                                <td><input name="D2" type="text" id="D2"
                                                        style="width:300px; height:25px">  s</td>
                                                <td><input name="D3" type="text" id="D3" value="≤ 180 s"
                                                        readonly="readonly"
                                                        style="width:110px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3">
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="c-content-panel">
                        <div class="c-label">本次校准结果的扩展不确定度 (<i>k</i>=2)</div>
                        <div class="c-body">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="table-responsive">
                                        <table class="table">
                                            <tbody>
                                                <tr>

                                                    <th colspan="2">示值误差<i>Urel</i>= <input name="K0" type="text"
                                                            id="K0" value="2.8" style="width:110px; height:25px">
                                                        %
                                                    </th>
                                                    <!--<th>k = --><input name="K1" type="hidden" id="K1"
                                                        style="width:110px; height:25px"> <!--</th>-->
                                                </tr>

                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="table-responsive">
                                        <table class="table table-bordered">

                                            <tbody>
                                                <tr>
                                                    <th>校准员：</th>
                                                    <td><input name="calibrator" type="text" id="calibrator"
                                                            style="width:110px; height:25px;border-width: 0.5px; border-style: inset; background-color: #F3F3F3"
                                                            value="{{ windows_user }}"></td>
                                                    <th>核验员</th>
                                                    <td><input name="inspector_Users" type="text" id="inspector_Users"
                                                            style="width:110px; height:25px"></td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        <div class="S001">
                                            <br>
                                            <table>
                                                <tbody>
                                                    <tr>
                                                        <td colspan="5" align="center">
                                                            <input type="submit" name="Button2" value="提交校准"
                                                                onclick="javascript:if(Button2_onclick()==false) return false;"
                                                                id="Button2" style="width:80px;">
                                                        </td>

                                                    </tr>

                                                    <tr>
                                                        <td colspan="5" align="center">
                                                            <a href="/add/" class="btn btn-default btn-xs" style="margin-top: 10px;width: 80px;">取  消</a>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </form>
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">

            <div class="modal-body">
                <div class="alert alert-danger alert-dismissible fade in" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
                            aria-hidden="true">×</span></button>
                    <h4>注意!</h4>
                    <p>请确认相关数据已经填写正确，提交后无法修改！！！</p>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                        </button>
                        <button type="button" class="btn btn-danger" onclick="confirmAdd();">
                            确定提交
                        </button>
                    </div>
                </div>
            </div>


        </div>
    </div>

</body>


{% endblock %}

{% block js %}
<script src="/static/bootstrap/js/jquery.min.js" type="text/javascript"></script>
<script>

    $(document).ready(function () {

        // 为W1、W2列（C1, C2, C9, C10, C17, C18等）设置五位小数
        $('input[name^="C"]').each(function() {
            const fieldName = $(this).attr('name');
            // W1列 (1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89)
            // W2列 (2, 10, 18, 26, 34, 42, 50, 58, 66, 74, 82, 90)
            if ([1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 2, 10, 18, 26, 34, 42, 50, 58, 66, 74, 82, 90].includes(parseInt(fieldName.substring(1)))) {
                const val = parseFloat($(this).val());
                if (!isNaN(val)) {
                    $(this).val(val.toFixed(5));
                }
            }
            // 测量值、差值、示值误差列 (4, 5, 12, 13, 20, 21, 28, 29, 36, 37, 44, 45, 52, 53, 60, 61, 68, 69, 76, 77, 84, 85, 92, 93)
            else if ([4, 5, 12, 13, 20, 21, 28, 29, 36, 37, 44, 45, 52, 53, 60, 61, 68, 69, 76, 77, 84, 85, 92, 93].includes(parseInt(fieldName.substring(1)))) {
                const val = parseFloat($(this).val());
                if (!isNaN(val)) {
                    $(this).val(val.toFixed(3));
                }
            }
        });

        // 为B0-B20列设置三位小数
        $('input[name^="B"]').each(function() {
            const fieldName = $(this).attr('name');
            // B0, B4, B8, B12, B16, B20
            if ([0, 4, 8, 12, 16, 20].includes(parseInt(fieldName.substring(1)))) {
                const val = parseFloat($(this).val());
                if (!isNaN(val)) {
                    $(this).val(val.toFixed(3));
                }
            }
        });
        
        // 监听输入事件，实时格式化
        $(document).on('blur', 'input[name^="C"]', function() {
            const fieldName = $(this).attr('name');
            const val = parseFloat($(this).val());
            
            if (!isNaN(val)) {
                // W1、W2和标准值列保留五位小数
                if ([1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 2, 10, 18, 26, 34, 42, 50, 58, 66, 74, 82, 90].includes(parseInt(fieldName.substring(1)))) {
                    $(this).val(val.toFixed(5));
                }
                // 测量值、差值、示值误差列保留三位小数
                else if ([4, 5, 12, 13, 20, 21, 28, 29, 36, 37, 44, 45, 52, 53, 60, 61, 68, 69, 76, 77, 84, 85, 92, 93].includes(parseInt(fieldName.substring(1)))) {
                    $(this).val(val.toFixed(3));
                }
            }
        });

        // 监听B系列输入框的blur事件，实时格式化为三位小数
        $(document).on('blur', 'input[name^="B"]', function() {
            const fieldName = $(this).attr('name');
            const val = parseFloat($(this).val());
            
            if (!isNaN(val)) {
                // B0, B4, B8, B12, B16, B20保留三位小数
                if ([0, 4, 8, 12, 16, 20].includes(parseInt(fieldName.substring(1)))) {
                    $(this).val(val.toFixed(3));
                }
            }
        });

        $('#tools tr:gt(0)').each(function () {
            $(this).find('td:eq(1) select').change(function () {
                var selectedValue = $(this).val();
                var title = $(this).parent().siblings().eq(0).find('input').first()
                // var range = $(this).parent().siblings().eq(1).find('input').first()
                // var certificate_number = $(this).parent().siblings().eq(2).find('input').first()
                // var end_date = $(this).parent().siblings().eq(3).find('input').first()
                var cal_jigou = $(this).parent().siblings().eq(4).find('input').first()
                var property = $(this).parent().siblings().eq(5).find('input').first()

                $.ajax({
                    type: "GET",
                    url: "/tools/",  // 替换为您的URL
                    dataType: 'JSON',
                    data: {
                        'value': selectedValue,
                    },
                    success: function (data) {
                        // 假设返回的数据填充到input
                        var n = data.datalist;
                        title.val(n[0].fields.title);
                        // range.val(n[0].fields.range);
                        // certificate_number.val(n[0].fields.certificate_number);
                        // end_date.val(n[0].fields.end_date);
                        cal_jigou.val(n[0].fields.cal_jigou);
                        property.val(n[0].fields.property);
                    }
                });
            });

        });


    });
</script>

{% endblock %}